package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.vo.DishVO;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {

    @ApiOperation("菜品分页查询")
    Page<DishVO> page(DishPageQueryDTO dishPageQueryDTO);

    @ApiOperation("新增菜品")
    void insert(Dish dish);

    @ApiOperation("根据id查询菜品")
    @Select("select * from dish where id = #{id}")
    Dish getById(Long id);

    @ApiOperation("根据id删除菜品")
    @Delete("delete from dish where id = #{id}")
    void deleteById(Long id);

    @ApiOperation("修改菜品")
    void update(Dish dish);

    @ApiOperation("根据分类id查询菜品")
    List<Dish> list(Dish dish);

    @ApiOperation("根据套餐id查询菜品")
    @Select("select * from dish where setmeal_id = #{id}")
    List<Dish> getBySetmealId(Long id);
}
